//
//  ToDoCellView.m
//  HappyPenguin
//
//  Created by zhuangyihang on 1/14/16.
//  Copyright © 2016 zhuangyihang. All rights reserved.
//

#import "ToDoCellView.h"
#import "UIConstants.h"

static const NSInteger kMarginLeft = 15;
static const NSInteger kTitleLabelFontSize = 16;

@implementation ToDoCellView

- (id)init{
    self = [super init];
    if (self) {
        self.imageView = [UIImageView new];
        [self addSubview:self.imageView];
        [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(kMarginLeft);
            make.centerY.equalTo(self);
        }];
        
        self.titleLabel = [UILabel new];
        [self addSubview:self.titleLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.imageView.mas_right).offset(5);
            make.centerY.equalTo(self);
        }];
        self.titleLabel.font = [UIConstants getFont:kTitleLabelFontSize];
        
        self.arrowImageView = [UIImageView new];
        [self addSubview:self.arrowImageView];
        [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.right.equalTo(self).offset(-5);
        }];
        
        self.detailLabel = [UILabel new];
        [self addSubview:self.detailLabel];
        [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
        }];
        
        self.seperatorView = [UIView new];
        [self addSubview:self.seperatorView];
        [self.seperatorView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.equalTo(@1);
            make.width.centerX.bottom.equalTo(self);
        }];
        self.seperatorView.backgroundColor = [UIConstants getSeperatorColor];
        
        self.arrowImageView = [UIImageView new];
        [self addSubview:self.arrowImageView];
        [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.right.equalTo(self).offset(-10);
        }];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
